/**
 * Copyright 2013 Viettel Telecom. All rights reserved.
 * VIETTEL PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.viettel.junit4;

import java.util.ArrayList;
import java.util.List;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.viettel.core.bussiness.report.ReportUserMgr;
import com.viettel.core.common.utils.KPaging;
import com.viettel.core.dao.report.ReportGeneralDAO;
import com.viettel.core.dao.report.ReportUserDAO;
import com.viettel.core.entities.report.ReportUserTextDaily;
import com.viettel.core.entities.report.vo.ReportGeneralFilter;
import com.viettel.core.entities.report.vo.ReportGeneralVO;
import com.viettel.core.entities.report.vo.ReportUserFilter;
import com.viettel.core.entities.report.vo.ReportUserVO;
import com.viettel.core.enumtype.ReportGeneralType;

//import com.viettel.core.dao.UsersDAO;

/**
 *  Mo ta muc dich cua lop (interface)
 *  @author: ToanTM1
 *  @version: 1.0
 *  @since: 1.0
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "/spring/applicationContext.xml" })
public class ReportGeneral {

	
	@Autowired
	ReportGeneralDAO reportGeneralDAO;	
	
	@Test
	public void getReportText() {		
		try {		
			ReportGeneralFilter filter=new ReportGeneralFilter();
			List<ReportGeneralVO> list=new ArrayList<ReportGeneralVO>();
			KPaging<ReportGeneralVO> paging=new KPaging<ReportGeneralVO> ();
			filter.setFromDate("06/2014");
			filter.setToDate("07/2014");
			paging.setPage(0);
			paging.setPageSize(20);
			filter.setPaging(paging);
			filter.setTypeReport(ReportGeneralType.YEAR_RANGE);
			
			list=reportGeneralDAO.getReportText(filter);
			System.out.println("ServiceNumber       GroupName                            SMS Nhan        SMS gui      SMS sua       SMS loi        doanh thu           Doanh thu VAT");
			for (ReportGeneralVO vo : list) {
				System.out.println(vo.getServiceNumber()+"            "+vo.getGroupName()+"         "+vo.getSmsReceive()+"         "+vo.getSmsSent()+"         "+vo.getSmsRepair()+"         "+vo.getSmsError()+"         "+vo.getMoney()+"         "+vo.getMoneyVAT());
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}	
	
	@Test
	public void getReportSub() {		
		try {		
			ReportGeneralFilter filter=new ReportGeneralFilter();
			List<ReportGeneralVO> list=new ArrayList<ReportGeneralVO>();
			KPaging<ReportGeneralVO> paging=new KPaging<ReportGeneralVO> ();
			filter.setFromDate("06/2014");
			filter.setToDate("07/2014");
			paging.setPage(0);
			paging.setPageSize(20);
			filter.setPaging(paging);
			filter.setTypeReport(ReportGeneralType.THIS_MONTH);
			
			list=reportGeneralDAO.getReportSub(filter);
			System.out.println("--------------------");
			for (ReportGeneralVO vo : list) {
				System.out.println(vo.getGroupName()+"         "+vo.getTotalSubscription()+"         "+vo.getChargeTotal()+"         "+vo.getChargeOk()+"         "+vo.getChargeNOK1()+"         "+vo.getChargeNOK2()+"         "+vo.getChargeNOK3()+"         "+vo.getSmsSent()+"         "+vo.getMoney()+"         "+vo.getMoneyVAT());
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}	
	
	
	@Test
	public void getReportAll() {		
		try {		
			ReportGeneralFilter filter=new ReportGeneralFilter();
			List<ReportGeneralVO> list=new ArrayList<ReportGeneralVO>();
			KPaging<ReportGeneralVO> paging=new KPaging<ReportGeneralVO> ();
			filter.setFromDate("19/07/2014");
			filter.setToDate("20/07/2014");
			paging.setPage(0);
			paging.setPageSize(20);
			filter.setPaging(paging);
			filter.setTypeReport(ReportGeneralType.DATE_RANGE);
			
			list=reportGeneralDAO.getReportAll(filter);
			System.out.println("--------------------");
			for (ReportGeneralVO vo : list) {
				System.out.println(vo.getGroupName()+"         "+vo.getTotalSubscription()+"         "+vo.getChargeOk()+"         "+vo.getChargeNOK1()+"         "+vo.getChargeNOK2()+"         "+vo.getChargeNOK3()+"         "+vo.getSmsSent()+"         "+vo.getMoney()+"         "+vo.getMoneyVAT());
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}	
	
	
	
	
	
	
	
	
}

